home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / GETCRDIR.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  450 b   |  19 lines

  1. /* getcrdir.c --- p. 602 */
  2. #include <stdio.h>
  3. #include <dir.h>
  4. main()
  5. {
  6.     int cur_drive;
  7.     char path[MAXPATH]; /* MAXPATH is defined in dir.h */
  8. /* First get the current drive */
  9.     cur_drive =getdisk();
  10. /* Convert drive number to a letter */
  11.     path[0] = cur_drive + 'A';
  12.     path[1] = ':';
  13.     path[2] = '\\';
  14. /* Now get the directory name to complete the path name */
  15.     getcurdir(0, path+3);
  16.     printf("Current path name is: %s\n", path);
  17. }
  18.  
  19.